package gridsoft.sapi.contoller;

import gridsoft.sapi.config.Result;
import org.noear.snack.ONode;
import org.noear.solon.annotation.*;
import org.noear.solon.core.handle.Context;

@Controller
public class SAuth {

    @Post
    @Mapping("/auth/login")
    public Object sLogin(Context ctx, @Body String body) throws Exception {
        ONode req = ONode.load(body);
        if (req.getOrNull("username") == null || req.getOrNull("password") == null) {
            return Result.failure(400, "请求参数不正确!");
        }
        String username = req.get("username").getString();
        String password = req.get("password").getString();
        return "ok";
    }
}
